package com.study.scala.implicits

/**
  *
  * @author stephen
  * @create 2019-03-18 18:07
  * @since 1.0.0
  */
object ImplicitClassDemo {

  implicit class Calculator(x:Int){
    def add(y:Int)=x+y
  }

  def main(args: Array[String]): Unit = {
    // Int类型都会有add方法
    val result = 1.add(2)
    println(result)
  }
}

